package linkwechat.controller.system;

import linkwechat.pojo.*;
import linkwechat.sysservice.SysMenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("sysMenu")
@RestController
public class SysMenuController {

    @Resource
    SysMenuService sysMenuService;

    //    菜单查询
    @RequestMapping("selectMenuList")
    public ReturnData deptSelect(){
        List<SysMenu> list = sysMenuService.SelectMenuList();
        return ReturnData.setResp(ReturnEnum.QUERY_SUCCEED,list);
    }

    //    新增菜单
    @RequestMapping("InsertMenu")
    public ReturnData InsertMenu(SysMenu sysMenu) {
        int i = sysMenuService.InsertMenu(sysMenu);
        return ReturnData.setResp(ReturnEnum.APPEND_SUCCEED,i);
    }


    //    修改菜单
    @RequestMapping("UpdateMenu")
    public ReturnData UpdateMenu(SysMenu sysMenu) {
        int i = sysMenuService.UpdateMenu(sysMenu);
        return ReturnData.setResp(ReturnEnum.APPEND_SUCCEED,i);
    }

    //    删除菜单
    @RequestMapping("RemoveMenuById")
    public ReturnData RemoveMenuById(Long menuId) {
        int i = sysMenuService.RemoveMenuById(menuId);
        return ReturnData.setResp(ReturnEnum.APPEND_SUCCEED,i);
    }





}
